var app = getApp(),
  common = require("../common/common.js");

Page({
  data: {
    pagePath: "../user/user"
  },
  call: function() {
    var a = this.data.map;
    wx.makePhoneCall({
      phoneNumber: a.content.mobile
    });
  },
  // 在线客服
  onlineService(){
   wx.showToast({
     title: '暂未接入客服',
     icon: 'none',     
     duration: 2000
   })
  },
  // 前往抄错题解析页面
  tofalse(){
    let id = wx.getStorageSync('false_ques')
    wx.navigateTo({
      url: '/xc_train/pages/online/error_test/error_test?id=' + id
    })
  },
  map: function() {
    var a = this.data.map;
    wx.openLocation({
      latitude: parseFloat(a.content.latitude),
      longitude: parseFloat(a.content.longitude),
      name: a.content.address,
      address: a.content.address,
      scale: 28
    });
  },
  to_shop: function() {
    app.util.request({
      url: "entry/wxapp/user",
      showLoading: !1,
      data: {
        op: "userinfo"
      },
      success: function(a) {
        var t = a.data;
        "" != t.data && (-1 == t.data.shop ? wx.showModal({
          title: "错误",
          content: "没有权限"
        }) : 1 == t.data.shop ? wx.navigateTo({
          url: "../manage/index"
        }) : 2 == t.data.shop && wx.navigateTo({
          url: "../manage/index?&shop=" + t.data.shop_id
        }));
      }
    });
  },
  onLoad: function(a) {
    var o = this;
    common.config(o), common.theme(o), app.util.request({
      url: "entry/wxapp/user",
      data: {
        op: "map"
      },
      showLoading: !1,
      success: function(a) {
        var t = a.data;
        "" != t.data && o.setData({
          map: t.data
        });
      }
    }), o.setData({
      userinfo: app.userinfo,
      users:wx.getStorageSync("users")
    });
  },
  onReady: function() {},
  onShow: function() {},
  onHide: function() {},
  onUnload: function() {},
  onPullDownRefresh: function() {
    var o = this;
    app.util.request({
      url: "entry/wxapp/user",
      data: {
        op: "map"
      },
      showLoading: !1,
      success: function(a) {
        wx.stopPullDownRefresh();
        var t = a.data;
        "" != t.data && o.setData({
          map: t.data
        });
      }
    });
  },
  onReachBottom: function() {}
});